home *** CD-ROM | disk | FTP | other *** search
/ Inter.Net 55-1 / Inter.Net 55-1.iso / CBuilder / Setup / BCB / data.z / d3drmdef.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-09  |  13.9 KB  |  406 lines

  1. /*==========================================================================;
  2.  *
  3.  *  Copyright (C) 1995-1996 Microsoft Corporation.  All Rights Reserved.
  4.  *
  5.  *  File:       d3drm.h
  6.  *  Content:    Direct3DRM include file
  7.  *
  8.  ***************************************************************************/
  9.  
  10. #ifndef __D3DRMDEFS_H__
  11. #define __D3DRMDEFS_H__
  12. #pragma option push -b
  13.  
  14. #include <stddef.h>
  15. #include "d3dtypes.h"
  16.  
  17. #ifdef WIN32
  18. #define D3DRMAPI  __stdcall
  19. #else
  20. #define D3DRMAPI
  21. #endif
  22.  
  23. #if defined(__cplusplus)
  24. extern "C" {
  25. #endif
  26.  
  27. #ifndef TRUE
  28. #define FALSE 0
  29. #define TRUE 1
  30. #endif
  31.  
  32. typedef struct _D3DRMVECTOR4D
  33. {   D3DVALUE x, y, z, w;
  34. } D3DRMVECTOR4D, *LPD3DRMVECTOR4D;
  35.  
  36. typedef D3DVALUE D3DRMMATRIX4D[4][4];
  37.  
  38. typedef struct _D3DRMQUATERNION
  39. {   D3DVALUE s;
  40.     D3DVECTOR v;
  41. } D3DRMQUATERNION, *LPD3DRMQUATERNION;
  42.  
  43. typedef struct _D3DRMBOX
  44. {   D3DVECTOR min, max;
  45. } D3DRMBOX, *LPD3DRMBOX;
  46.  
  47. typedef void (*D3DRMWRAPCALLBACK)
  48.     (LPD3DVECTOR, int* u, int* v, LPD3DVECTOR a, LPD3DVECTOR b, LPVOID);
  49.  
  50. typedef enum _D3DRMLIGHTTYPE
  51. {   D3DRMLIGHT_AMBIENT,
  52.     D3DRMLIGHT_POINT,
  53.     D3DRMLIGHT_SPOT,
  54.     D3DRMLIGHT_DIRECTIONAL,
  55.     D3DRMLIGHT_PARALLELPOINT
  56. } D3DRMLIGHTTYPE, *LPD3DRMLIGHTTYPE;
  57.  
  58. typedef enum _D3DRMSHADEMODE {
  59.     D3DRMSHADE_FLAT     = 0,
  60.     D3DRMSHADE_GOURAUD  = 1,
  61.     D3DRMSHADE_PHONG    = 2,
  62.  
  63.     D3DRMSHADE_MASK     = 7,
  64.     D3DRMSHADE_MAX      = 8
  65. } D3DRMSHADEMODE, *LPD3DRMSHADEMODE;
  66.  
  67. typedef enum _D3DRMLIGHTMODE {
  68.     D3DRMLIGHT_OFF      = 0 * D3DRMSHADE_MAX,
  69.     D3DRMLIGHT_ON       = 1 * D3DRMSHADE_MAX,
  70.  
  71.     D3DRMLIGHT_MASK     = 7 * D3DRMSHADE_MAX,
  72.     D3DRMLIGHT_MAX      = 8 * D3DRMSHADE_MAX
  73. } D3DRMLIGHTMODE, *LPD3DRMLIGHTMODE;
  74.  
  75. typedef enum _D3DRMFILLMODE {
  76.     D3DRMFILL_POINTS    = 0 * D3DRMLIGHT_MAX,
  77.     D3DRMFILL_WIREFRAME = 1 * D3DRMLIGHT_MAX,
  78.     D3DRMFILL_SOLID     = 2 * D3DRMLIGHT_MAX,
  79.  
  80.     D3DRMFILL_MASK      = 7 * D3DRMLIGHT_MAX,
  81.     D3DRMFILL_MAX       = 8 * D3DRMLIGHT_MAX
  82. } D3DRMFILLMODE, *LPD3DRMFILLMODE;
  83.  
  84. typedef DWORD D3DRMRENDERQUALITY, *LPD3DRMRENDERQUALITY;
  85.  
  86. #define D3DRMRENDER_WIREFRAME   (D3DRMSHADE_FLAT+D3DRMLIGHT_OFF+D3DRMFILL_WIREFRAME)
  87. #define D3DRMRENDER_UNLITFLAT   (D3DRMSHADE_FLAT+D3DRMLIGHT_OFF+D3DRMFILL_SOLID)
  88. #define D3DRMRENDER_FLAT        (D3DRMSHADE_FLAT+D3DRMLIGHT_ON+D3DRMFILL_SOLID)
  89. #define D3DRMRENDER_GOURAUD     (D3DRMSHADE_GOURAUD+D3DRMLIGHT_ON+D3DRMFILL_SOLID)
  90. #define D3DRMRENDER_PHONG       (D3DRMSHADE_PHONG+D3DRMLIGHT_ON+D3DRMFILL_SOLID)
  91.  
  92. typedef enum _D3DRMTEXTUREQUALITY
  93. {   D3DRMTEXTURE_NEAREST,               /* choose nearest texel */
  94.     D3DRMTEXTURE_LINEAR,                /* interpolate 4 texels */
  95.     D3DRMTEXTURE_MIPNEAREST,            /* nearest texel in nearest mipmap  */
  96.     D3DRMTEXTURE_MIPLINEAR,             /* interpolate 2 texels from 2 mipmaps */
  97.     D3DRMTEXTURE_LINEARMIPNEAREST,      /* interpolate 4 texels in nearest mipmap */
  98.     D3DRMTEXTURE_LINEARMIPLINEAR        /* interpolate 8 texels from 2 mipmaps */
  99. } D3DRMTEXTUREQUALITY, *LPD3DRMTEXTUREQUALITY;
  100.  
  101. typedef enum _D3DRMCOMBINETYPE
  102. {   D3DRMCOMBINE_REPLACE,
  103.     D3DRMCOMBINE_BEFORE,
  104.     D3DRMCOMBINE_AFTER
  105. } D3DRMCOMBINETYPE, *LPD3DRMCOMBINETYPE;
  106.  
  107. typedef D3DCOLORMODEL D3DRMCOLORMODEL, *LPD3DRMCOLORMODEL;
  108.  
  109. typedef enum _D3DRMPALETTEFLAGS
  110. {   D3DRMPALETTE_FREE,                  /* renderer may use this entry freely */
  111.     D3DRMPALETTE_READONLY,              /* fixed but may be used by renderer */
  112.     D3DRMPALETTE_RESERVED               /* may not be used by renderer */
  113. } D3DRMPALETTEFLAGS, *LPD3DRMPALETTEFLAGS;
  114.  
  115. typedef struct _D3DRMPALETTEENTRY
  116. {   unsigned char red;          /* 0 .. 255 */
  117.     unsigned char green;        /* 0 .. 255 */
  118.     unsigned char blue;         /* 0 .. 255 */
  119.     unsigned char flags;        /* one of D3DRMPALETTEFLAGS */
  120. } D3DRMPALETTEENTRY, *LPD3DRMPALETTEENTRY;
  121.  
  122. typedef struct _D3DRMIMAGE
  123. {   int width, height;          /* width and height in pixels */
  124.     int aspectx, aspecty;       /* aspect ratio for non-square pixels */
  125.     int depth;                  /* bits per pixel */
  126.     int rgb;                    /* if false, pixels are indices into a
  127.                                    palette otherwise, pixels encode
  128.                                    RGB values. */
  129.     int bytes_per_line;         /* number of bytes of memory for a
  130.                                    scanline. This must be a multiple
  131.                                    of 4. */
  132.     void* buffer1;              /* memory to render into (first buffer). */
  133.     void* buffer2;              /* second rendering buffer for double
  134.                                    buffering, set to NULL for single
  135.                                    buffering. */
  136.     unsigned long red_mask;
  137.     unsigned long green_mask;
  138.     unsigned long blue_mask;
  139.     unsigned long alpha_mask;   /* if rgb is true, these are masks for
  140.                                    the red, green and blue parts of a
  141.                                    pixel.  Otherwise, these are masks
  142.                                    for the significant bits of the
  143.                                    red, green and blue elements in the
  144.                                    palette.  For instance, most SVGA
  145.                                    displays use 64 intensities of red,
  146.                                    green and blue, so the masks should
  147.                                    all be set to 0xfc. */
  148.     int palette_size;           /* number of entries in palette */
  149.     D3DRMPALETTEENTRY* palette; /* description of the palette (only if
  150.                                    rgb is false).  Must be (1<<depth)
  151.                                    elements. */
  152. } D3DRMIMAGE, *LPD3DRMIMAGE;
  153.  
  154. typedef enum _D3DRMWRAPTYPE
  155. {   D3DRMWRAP_FLAT,
  156.     D3DRMWRAP_CYLINDER,
  157.     D3DRMWRAP_SPHERE,
  158.     D3DRMWRAP_CHROME
  159. } D3DRMWRAPTYPE, *LPD3DRMWRAPTYPE;
  160.  
  161. #define D3DRMWIREFRAME_CULL             1 /* cull backfaces */
  162. #define D3DRMWIREFRAME_HIDDENLINE       2 /* lines are obscured by closer objects */
  163.  
  164. typedef enum _D3DRMPROJECTIONTYPE
  165. {   D3DRMPROJECT_PERSPECTIVE,
  166.     D3DRMPROJECT_ORTHOGRAPHIC
  167. } D3DRMPROJECTIONTYPE, *LPD3DRMPROJECTIONTYPE;
  168.  
  169. typedef enum _D3DRMXOFFORMAT
  170. {   D3DRMXOF_BINARY,
  171.     D3DRMXOF_COMPRESSED,
  172.     D3DRMXOF_TEXT
  173. } D3DRMXOFFORMAT, *LPD3DRMXOFFORMAT;
  174.  
  175. typedef DWORD D3DRMSAVEOPTIONS;
  176. #define D3DRMXOFSAVE_NORMALS 1
  177. #define D3DRMXOFSAVE_TEXTURECOORDINATES 2
  178. #define D3DRMXOFSAVE_MATERIALS 4
  179. #define D3DRMXOFSAVE_TEXTURENAMES 8
  180. #define D3DRMXOFSAVE_ALL 15
  181. #define D3DRMXOFSAVE_TEMPLATES 16
  182.  
  183. typedef enum _D3DRMCOLORSOURCE
  184. {   D3DRMCOLOR_FROMFACE,
  185.     D3DRMCOLOR_FROMVERTEX
  186. } D3DRMCOLORSOURCE, *LPD3DRMCOLORSOURCE;
  187.  
  188. typedef enum _D3DRMFRAMECONSTRAINT
  189. {   D3DRMCONSTRAIN_Z,           /* use only X and Y rotations */
  190.     D3DRMCONSTRAIN_Y,           /* use only X and Z rotations */
  191.     D3DRMCONSTRAIN_X            /* use only Y and Z rotations */
  192. } D3DRMFRAMECONSTRAINT, *LPD3DRMFRAMECONSTRAINT;
  193.  
  194. typedef enum _D3DRMMATERIALMODE
  195. {   D3DRMMATERIAL_FROMMESH,
  196.     D3DRMMATERIAL_FROMPARENT,
  197.     D3DRMMATERIAL_FROMFRAME
  198. } D3DRMMATERIALMODE, *LPD3DRMMATERIALMODE;
  199.  
  200. typedef enum _D3DRMFOGMODE
  201. {   D3DRMFOG_LINEAR,            /* linear between start and end */
  202.     D3DRMFOG_EXPONENTIAL,       /* density * exp(-distance) */
  203.     D3DRMFOG_EXPONENTIALSQUARED /* density * exp(-distance*distance) */
  204. } D3DRMFOGMODE, *LPD3DRMFOGMODE;
  205.  
  206. typedef enum _D3DRMZBUFFERMODE {
  207.     D3DRMZBUFFER_FROMPARENT,    /* default */
  208.     D3DRMZBUFFER_ENABLE,        /* enable zbuffering */
  209.     D3DRMZBUFFER_DISABLE        /* disable zbuffering */
  210. } D3DRMZBUFFERMODE, *LPD3DRMZBUFFERMODE;
  211.  
  212. typedef enum _D3DRMSORTMODE {
  213.     D3DRMSORT_FROMPARENT,       /* default */
  214.     D3DRMSORT_NONE,             /* don't sort child frames */
  215.     D3DRMSORT_FRONTTOBACK,      /* sort child frames front-to-back */
  216.     D3DRMSORT_BACKTOFRONT       /* sort child frames back-to-front */
  217. } D3DRMSORTMODE, *LPD3DRMSORTMODE;
  218.  
  219. typedef DWORD D3DRMANIMATIONOPTIONS;
  220. #define D3DRMANIMATION_OPEN 0x01L
  221. #define D3DRMANIMATION_CLOSED 0x02L
  222. #define D3DRMANIMATION_LINEARPOSITION 0x04L
  223. #define D3DRMANIMATION_SPLINEPOSITION 0x08L
  224. #define D3DRMANIMATION_SCALEANDROTATION 0x00000010L
  225. #define D3DRMANIMATION_POSITION 0x00000020L
  226.  
  227. typedef DWORD D3DRMLOADOPTIONS;
  228.  
  229. #define D3DRMLOAD_FROMFILE  0x00L
  230. #define D3DRMLOAD_FROMRESOURCE 0x01L
  231. #define D3DRMLOAD_FROMMEMORY 0x02L
  232. #define D3DRMLOAD_FROMSTREAM 0x04L
  233.  
  234. #define D3DRMLOAD_BYNAME 0x10L
  235. #define D3DRMLOAD_BYPOSITION 0x20L
  236. #define D3DRMLOAD_BYGUID 0x40L
  237. #define D3DRMLOAD_FIRST 0x80L
  238.  
  239. #define D3DRMLOAD_INSTANCEBYREFERENCE 0x100L
  240. #define D3DRMLOAD_INSTANCEBYCOPYING 0x200L
  241.  
  242. typedef struct _D3DRMLOADRESOURCE {
  243.   HMODULE hModule;
  244.   LPCTSTR lpName;
  245.   LPCTSTR lpType;
  246. } D3DRMLOADRESOURCE, *LPD3DRMLOADRESOURCE;
  247.  
  248. typedef struct _D3DRMLOADMEMORY {
  249.   LPVOID lpMemory;
  250.   DWORD dSize;
  251. } D3DRMLOADMEMORY, *LPD3DRMLOADMEMORY;
  252.  
  253. typedef enum _D3DRMUSERVISUALREASON {
  254.     D3DRMUSERVISUAL_CANSEE,
  255.     D3DRMUSERVISUAL_RENDER
  256. } D3DRMUSERVISUALREASON, *LPD3DRMUSERVISUALREASON;
  257.  
  258.  
  259. typedef DWORD D3DRMMAPPING, D3DRMMAPPINGFLAG, *LPD3DRMMAPPING;
  260. static const D3DRMMAPPINGFLAG D3DRMMAP_WRAPU = 1;
  261. static const D3DRMMAPPINGFLAG D3DRMMAP_WRAPV = 2;
  262. static const D3DRMMAPPINGFLAG D3DRMMAP_PERSPCORRECT = 4;
  263.  
  264. typedef struct _D3DRMVERTEX
  265. {   D3DVECTOR       position;
  266.     D3DVECTOR       normal;
  267.     D3DVALUE        tu, tv;
  268.     D3DCOLOR        color;
  269. } D3DRMVERTEX, *LPD3DRMVERTEX;
  270.  
  271. typedef LONG D3DRMGROUPINDEX; /* group indexes begin a 0 */
  272. static const D3DRMGROUPINDEX D3DRMGROUP_ALLGROUPS = -1;
  273.  
  274. /*
  275.  * Create a color from three components in the range 0-1 inclusive.
  276.  */
  277. extern D3DCOLOR D3DRMAPI        D3DRMCreateColorRGB(D3DVALUE red,
  278.                                           D3DVALUE green,
  279.                                           D3DVALUE blue);
  280.  
  281. /*
  282.  * Create a color from four components in the range 0-1 inclusive.
  283.  */
  284. extern D3DCOLOR D3DRMAPI        D3DRMCreateColorRGBA(D3DVALUE red,
  285.                                                  D3DVALUE green,
  286.                                                  D3DVALUE blue,
  287.                                                  D3DVALUE alpha);
  288.  
  289. /*
  290.  * Get the red component of a color.
  291.  */
  292. extern D3DVALUE                 D3DRMAPI D3DRMColorGetRed(D3DCOLOR);
  293.  
  294. /*
  295.  * Get the green component of a color.
  296.  */
  297. extern D3DVALUE                 D3DRMAPI D3DRMColorGetGreen(D3DCOLOR);
  298.  
  299. /*
  300.  * Get the blue component of a color.
  301.  */
  302. extern D3DVALUE                 D3DRMAPI D3DRMColorGetBlue(D3DCOLOR);
  303.  
  304. /*
  305.  * Get the alpha component of a color.
  306.  */
  307. extern D3DVALUE                 D3DRMAPI D3DRMColorGetAlpha(D3DCOLOR);
  308.  
  309. /*
  310.  * Add two vectors.  Returns its first argument.
  311.  */
  312. extern LPD3DVECTOR      D3DRMAPI D3DRMVectorAdd(LPD3DVECTOR d,
  313.                                           LPD3DVECTOR s1,
  314.                                           LPD3DVECTOR s2);
  315.  
  316. /*
  317.  * Subtract two vectors.  Returns its first argument.
  318.  */
  319. extern LPD3DVECTOR      D3DRMAPI D3DRMVectorSubtract(LPD3DVECTOR d,
  320.                                                LPD3DVECTOR s1,
  321.                                                LPD3DVECTOR s2);
  322. /*
  323.  * Reflect a ray about a given normal.  Returns its first argument.
  324.  */
  325. extern LPD3DVECTOR      D3DRMAPI D3DRMVectorReflect(LPD3DVECTOR d,
  326.                                               LPD3DVECTOR ray,
  327.                                               LPD3DVECTOR norm);
  328.  
  329. /*
  330.  * Calculate the vector cross product.  Returns its first argument.
  331.  */
  332. extern LPD3DVECTOR      D3DRMAPI D3DRMVectorCrossProduct(LPD3DVECTOR d,
  333.                                                    LPD3DVECTOR s1,
  334.                                                    LPD3DVECTOR s2);
  335. /*
  336.  * Return the vector dot product.
  337.  */
  338. extern D3DVALUE                 D3DRMAPI D3DRMVectorDotProduct(LPD3DVECTOR s1,
  339.                                                  LPD3DVECTOR s2);
  340.  
  341. /*
  342.  * Scale a vector so that its modulus is 1.  Returns its argument or
  343.  * NULL if there was an error (e.g. a zero vector was passed).
  344.  */
  345. extern LPD3DVECTOR      D3DRMAPI D3DRMVectorNormalize(LPD3DVECTOR);
  346. #define D3DRMVectorNormalise D3DRMVectorNormalize
  347.  
  348. /*
  349.  * Return the length of a vector (e.g. sqrt(x*x + y*y + z*z)).
  350.  */
  351. extern D3DVALUE                 D3DRMAPI D3DRMVectorModulus(LPD3DVECTOR v);
  352.  
  353. /*
  354.  * Set the rotation part of a matrix to be a rotation of theta radians
  355.  * around the given axis.
  356.  */
  357.  
  358. extern LPD3DVECTOR      D3DRMAPI D3DRMVectorRotate(LPD3DVECTOR r, LPD3DVECTOR v, LPD3DVECTOR axis, D3DVALUE theta);
  359.  
  360. /*
  361.  * Scale a vector uniformly in all three axes
  362.  */
  363. extern LPD3DVECTOR      D3DRMAPI D3DRMVectorScale(LPD3DVECTOR d, LPD3DVECTOR s, D3DVALUE factor);
  364.  
  365. /*
  366.  * Return a random unit vector
  367.  */
  368. extern LPD3DVECTOR      D3DRMAPI D3DRMVectorRandom(LPD3DVECTOR d);
  369.  
  370. /*
  371.  * Returns a unit quaternion that represents a rotation of theta radians
  372.  * around the given axis.
  373.  */
  374.  
  375. extern LPD3DRMQUATERNION D3DRMAPI D3DRMQuaternionFromRotation(LPD3DRMQUATERNION quat,
  376.                                                               LPD3DVECTOR v,
  377.                                                               D3DVALUE theta);
  378.  
  379. /*
  380.  * Calculate the product of two quaternions
  381.  */
  382. extern LPD3DRMQUATERNION D3DRMAPI D3DRMQuaternionMultiply(LPD3DRMQUATERNION q,
  383.                                                           LPD3DRMQUATERNION a,
  384.                                                           LPD3DRMQUATERNION b);
  385.  
  386. /*
  387.  * Interpolate between two quaternions
  388.  */
  389. extern LPD3DRMQUATERNION D3DRMAPI D3DRMQuaternionSlerp(LPD3DRMQUATERNION q,
  390.                                                        LPD3DRMQUATERNION a,
  391.                                                        LPD3DRMQUATERNION b,
  392.                                                        D3DVALUE alpha);
  393.  
  394. /*
  395.  * Calculate the matrix for the rotation that a unit quaternion represents
  396.  */
  397. extern void             D3DRMAPI D3DRMMatrixFromQuaternion(D3DRMMATRIX4D dmMat, LPD3DRMQUATERNION lpDqQuat);
  398.  
  399.  
  400. #if defined(__cplusplus)
  401. };
  402. #endif
  403.  
  404. #pragma option pop
  405. #endif
  406.